﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using System.Data.Entity;
namespace BLL
{
   public class NhanVienBLL
    {
       QLKSEntities db = new QLKSEntities();
       public List<NhanVien>DSNV()
       {
           return db.NhanViens.ToList();
       }
       public bool AddNV(string ma,string ten,bool gioitinh,string diachi,string socmtnd)
       {
           NhanVien nv = new NhanVien();
           //nv = db.NhanViens.Where(p => p.MaNV == ma).FirstOrDefault();
           nv.MaNV = ma;
           nv.TenNV = ten;
           nv.GioiTinh = gioitinh;
           nv.DiaChi = diachi;
           nv.CMNDNV = socmtnd;
           db.NhanViens.AddObject(nv);
           try
           {
               db.SaveChanges();
               return true;
           }
           catch (Exception)
           {
               return false;
           }
       }
    }
}
